import service from "@/utils/request"

import LoginWork from "@/utils/LoginWork" 
// 指令材料
export interface CommandMaterialParmsList{
    lotNo:string,
    mtlName:string,
    pageNum:number,
    pageSize:number,
    style:string,
    typeNo:string
}

export interface CommandMaterialInterface{
    dtos:any[],
    total?:number
}

export const CommandMaterial = (type:number,parms:CommandMaterialParmsList) => {
    return service.put<any,CommandMaterialInterface>(`/pcFactorStockQuery/getMOSLotMtlQuery?type=${type}`,parms)
}

// 贴合子材料明细查询
export interface QueryTheDetailsOfTheFitSubMateriaInterface{
    mtlNo: string,
    mtlColor: string,
    mtlName: string,
    mtlSpec: string,
    mtlUnit: string,
    percent: string,
    purFlag: string
}

export const QueryTheDetailsOfTheFitSubMateria = (mtlNo:string) => {
    return service.post<any,QueryTheDetailsOfTheFitSubMateriaInterface[]>(`/pcFactorStockQuery/getMOSSubMtlQuery?mtlNo=${mtlNo}`)
}

// 待出剩料明细查询
export const BringOutTheRemainingMaterialDetailsForInquiry = () => {
    return service.get<any,any>('/pcFactorStockQuery/getMOSTempQuery')
}

// 剩料出库明细
export interface DetailsOfRemainingMaterialsOutOfStorageParms{
    lotNo:string,
    mtlName:string,
    slipDateEnd:string,
    slipDateStart:string,
    slipNo:string,
    slipReason:string
}

export interface DetailsOfRemainingMaterialsOutOfStorageInterface{
    slipNo: string,
    slipDate: string,
    slipReason: string,
    lotNo: null,
    mtlColor: null,
    mtlName: string,
    mtlSpec: string,
    mtlUnit: string,
    qty: number,
    remark: string | null,
    mtlNo: string,
    deptName: null,
    price: null,
    amt: null,
    sysUser: string
}

export const DetailsOfRemainingMaterialsOutOfStorage = (parms:DetailsOfRemainingMaterialsOutOfStorageParms) => {
    return service.put<any,DetailsOfRemainingMaterialsOutOfStorageInterface[]>(`/pcFactorStockQuery/getMOSDetailQuery`,parms)
}

// 部门查询
export const DepartmentInquiry = () => {
    return service.get<any,any>(`/back/deptQuery`)
}

// 待出剩料明细新增
export const DetailsOfRemainingMaterialsToBeDeliveredAreAdded = (type:number,parms:any) => {
    return LoginWork.put<any,any>(`/pcFactorStockQuery/mOSTempAdd?type=${type}`,parms)
}

// 待出库明细删除
export const  TheDetailsToBeReleasedAreDeleted = (mtlNo:string) => {
    return LoginWork.post<any,any>(`/pcFactorStockQuery/mOSTempDelete?mtlNo=${mtlNo}`)
}

// 待出明细删除
export const DetailsToBeReleasedAreDeleted = (mtlNo:string,slipNo:string) => {
    return LoginWork.post<any,any>(`/pcFactorStockQuery/mOSDetailDelete?mtlNo=${mtlNo}&slipNo=${slipNo}`)
}

// 出库批处理新增
export const OutboundBatchProcessingAdded = (parms:any) => {
    return LoginWork.put<any,any>(`/pcFactorStockQuery/mOSDetailAdd`,parms)
}